/**
 * Created by hcadmin on 16/4/18.
 */
define([
    "jquery",
    "IO",
    "UPLOADUI",
    "UPLOAD",
    "jqueryUI",
    "bootbox"
], function ($, IO, upui, up, jui, bootbox, definebt) {
    $(function () {

        gettable();

    });

    function gettable() {

        var grid;
        //每列数据列性
        var columns = [
            {
                title: '问卷名',
                dataIndex: 'realname',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].realname + "</span>";
                    //return "<span><img src='" + data[datarow].user_name + "' width='80px;' height='80px;'>&nbsp;&nbsp;</span>" + data[datarow].title + "</span>";
                }
            },
            {
                title: ' 所属课程',
                dataIndex: 'phone',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].phone + "</span>";
                    //return "<span><img src='" + data[datarow].user_name + "' width='80px;' height='80px;'>&nbsp;&nbsp;</span>" + data[datarow].title + "</span>";
                }
            },
            {
                title: '题目数',
                dataIndex: 'province_name',
                dataSource: function (data, datarow, gridobj, current_column) {

                    return "<span>" + province_nameShow(data[datarow].province_id) + "</span>";
                    //return "<span><img src='" + data[datarow].user_name + "' width='80px;' height='80px;'>&nbsp;&nbsp;</span>" + data[datarow].title + "</span>";
                }
            },
            {
                title: '未填写人数',
                dataIndex: 'city_name',
                dataSource: function (data, datarow, gridobj, current_column) {

                    return "<span>" + city_nameShow(data[datarow].province_id, data[datarow].city_id) + "</span>";
                    //return "<span><img src='" + data[datarow].user_name + "' width='80px;' height='80px;'>&nbsp;&nbsp;</span>" + data[datarow].title + "</span>";
                }
            },

            {
                title: '操作',
                dataIndex: 'action',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<a class='editmodal' href='#' data-toggle='modal' data-target='#myModal' act_id=" + data[datarow].doctorapply_id + "><span style='color: #6ab7ad;'>" + " 详情" + "</span></a>" +
                        "+"  "+<span style='color: red;'>删除</span>";

                }
            }
        ];
        //数组初始化
        function dataInit() {

            grid = new Grid("/api/doctorApplieslist", $("#table_my_toast"), $("#paging_my_toast"), 1, 10, columns, get_input_param(), 10);
            //初始化
            grid.Init();

        }

        //获取输入框内容
        function get_input_param() {
            var param = "realname=" + realname + "&status=" + status;
            return param;
        }
        dataInit();
    }

});

//详情按钮
$(document).on("click", ".editmodal", function () {
    //先查数据绑定到页面上,然后手动调用modal

    $('#myModaledit').modal();

});